<?php $this->_extends('_layouts/bocib_layout'); ?>

<?php $this->_block('content');?>
<div id="content">
    <h2><?=$_SESSION['lname'];?></h2>
    <form action="<?=url('bofaculty/editteacher');?>" method="post" enctype="multipart/form-data">
        <div>
            <?php $teacher = Teacher::find('teacher_id = ?', $_SESSION['tid'])->query();?>
            <label>姓名&nbsp;</label>
            <input type="text" name="tname" value="<?=$_SESSION['lname'];?>" readonly="readonly" /><br />
            <label>系别&nbsp;</label>
            <select name="tmajor_id">
                <option value="<?=$teacher->major_id;?>">当前是：<?=$teacher->major->major;?></option>
                <?php foreach(Major::find()->all()->query() as $major) { ?>
                <option value="<?=$major->major_id;?>"><?=$major->major;?></option>
                <?php } ?>
            </select>
            <br />

            <label>头衔&nbsp;</label>
            <?php foreach($ytitles as $ytitle) { ?>
            <input type="checkbox" name="ttitle[]" value="<?=$ytitle->title_id;?>" checked="checked" />
            <label><?=$ytitle->title;?></label>
            <?php } ?>

            <?php foreach($ntitles as $ntitle) { ?>
            <input type="checkbox" name="ttitle[]" value="<?=$ntitle->title_id;?>" />
            <label><?=$ntitle->title;?></label>
            <?php } ?>
            <br />

            <label>Email</label>
            <input type="text" name="temail" value="<?=$teacher->email;?>" /><br />
            <label>Phone</label>
            <input type="text" name="tphone" value="<?=$teacher->phone;?>" /><br />
            <label>fax&nbsp;&nbsp;</label>
            <input type="text" name="tfax" value="<?=$teacher->fax;?>" /><br />
            <label>设置课件密码</label>
            <input type="text" name="taccesscode" value="<?=$teacher->accesscode;?>" /><br />
            <label>显示研究成果信息：</label>
            <input type="checkbox" name="tshowresearch" value="1"
                <?php if($teacher->showresearch == 1) { ?>
                checked="checked"
                <?php } ?>
            /><br />
            <label>更改头像<span class="stips pdl20">建议尺寸：210 * 286</span></label>
            <input type="file" name="tprofile" /><br />
            <label>简介:</label><br />	
			
			<?php $this->_control('fckeditor', 'tdescription' , array('base_dir' => '/misc/fckeditor', 'instanceName'=>'tdescription', 'value'=>$teacher->description)); ?>

            <input type="submit" value="保存基本信息修改" /><br />
        </div>
    </form>
    <div class="readonly">
        <label><b>授课课程(修改请点击“更改教师授课关系（teacher_course）”)</b></label>
        <p>
            <?php
            foreach($teacher->courses as $course)
            {
                echo $course->course,' ';
            }
            ?>
        </p>
        <label>目前使用的头像</label>
        <p class="highlight">注意：更新头像后，可能出现头像没有刷新的现象，请<a href="<?=url('faculty/facultylist');?>" style="text-decoration:underline;">点击此处</a>查看新头像 ，或者手动清空浏览器缓存。</p>
        <p><img src="<?=$teacher->profile_path;?>" alt="<?=$_SESSION['lname'];?>" /></p>
    </div>
</div>
<?php $this->_endblock('content');?>